package com.culture.config.common.util;

import java.util.Objects;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import lombok.experimental.UtilityClass;

@UtilityClass
public class ReqeustsUtil {

    public static HttpServletRequest getHttpServletRequest(){  
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        if(Objects.isNull(requestAttributes)){
            return null;
        }
        return ((ServletRequestAttributes)requestAttributes).getRequest();   
    }     
}
